package bb.lanxing.adapter.team;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import bb.lanxing.App;
import bb.lanxing.R;
import bb.lanxing.fragment.team.TeamListFragment;

public class TeamAdapter extends FragmentPagerAdapter {
    private List<String> tabLayoutList = new ArrayList<>();
    private List<Fragment> fragmentList = new ArrayList<>();
    private TeamListFragment teamListFragment = new TeamListFragment();
    private TeamListFragment teamListFragment1 = new TeamListFragment();

    public TeamAdapter(FragmentManager fm) {
        super(fm);
        tabLayoutList.add(App.getContext().getString(R.string.event_tab_nearby));
        tabLayoutList.add(App.getContext().getString(R.string.event_tab_mine));

        teamListFragment.setType(0);
        teamListFragment1.setType(1);
        fragmentList.add(teamListFragment);
        fragmentList.add(teamListFragment1);
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabLayoutList.get(position);
    }
}